﻿// --------------------------------
// <copyright file="UniqueElementListTest.cs" company="TRONSoft">
//     Copyright (c) TRONSoft.
// </copyright>
// <license>
//   This source code is subject to terms and conditions of the Microsoft
//   Public License. A copy of the license can be found in the License.html
//   file at the root of this distribution. If you cannot locate the
//   Microsoft Public License, please send an email to dlr@microsoft.com.
//   By using this source code in any fashion, you are agreeing to be bound 
//   by the terms of the Microsoft Public License. You must not remove this
//   notice, or any other, from this software.
// </license>
// <author>Tron</author>
// ---------------------------------

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Tronsoft.Actucal.CalculationEngineCreator.Test
{
    [TestClass()]
    public class UniqueElementListTest
    {
        [TestMethod]
        [ExpectedException(typeof(CalculationException))]
        public void Should_Not_Be_Able_To_Add_More_Then_One_Item_Via_Add_Method()
        {
            UniqueElementList<string> uniqueList = new UniqueElementList<string>();
            uniqueList.Add(string.Empty);
            uniqueList.Add(string.Empty);
        }

        [TestMethod]
        [ExpectedException(typeof(CalculationException))]
        public void Should_Not_Be_Able_To_Add_More_Then_One_Item_Via_AddRange_Method()
        {
            UniqueElementList<string> uniqueList = new UniqueElementList<string>();
            uniqueList.AddRange(new string[] { "Hello", "Hello" });
        }

        [TestMethod]
        [ExpectedException(typeof(CalculationException))]
        public void Should_Not_Be_Able_To_Add_More_Then_One_Item_Via_Insert_Method()
        {
            UniqueElementList<string> uniqueList = new UniqueElementList<string>();
            uniqueList.Add(string.Empty);
            uniqueList.Insert(0, string.Empty);
        }

        [TestMethod]
        [ExpectedException(typeof(CalculationException))]
        public void Should_Not_Be_Able_To_Add_More_Then_One_Item_Via_InsertRange_Method()
        {
            UniqueElementList<string> uniqueList = new UniqueElementList<string>();
            uniqueList.Add(string.Empty);
            uniqueList.Add(string.Empty);
            uniqueList.InsertRange(1, new string[] { "Hello", "Hello" });
        }
    }
}
